<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>个人信息表</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <style>
        body {
            background-color: #f2f2f2;
            font-family: 'Arial', sans-serif;
        }

        .layui-container {
            width: 500px;
            margin: 0 auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin-top: 20px;
        }

        .layui-form-item {
            margin-bottom: 20px;
            width: 68%;
            margin-left: 76px;
        }

        .layui-form-label {
            height: 43px;
            line-height: 26px;
            width: 100px;
            text-align: right;
            font-weight: bold;
        }

        .layui-input-block {
            margin-left: 120px;
        }

        .layui-btn {
            margin-top: 10px;
        }
    </style>
</head>

<body>
<div class="layui-container">
    <form class="layui-form layui-form-pane" action="">
        <div style="text-align: center;margin-bottom: 15px"><p1 style="font-size:28px;">个人信息表</p1></div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
                <input type="text" name="username" id="username"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
                <input type="text" name="password" id="password"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-inline">
                <input type="text" name="email" id="email"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-inline">
                <input type="text" name="phoneNumber" id="phoneNumber"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">角色名</label>
            <div class="layui-input-inline">
                <input type="text" name="roleName" id="roleName" disabled  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-primary" type="button" onclick="updateBtn()">修改信息</button>
            </div>
        </div>
    </form>
</div>

<script src="../layui/layui.js"></script>
<script src="../js/public.js"></script>
<script>
    layui.use(['form', 'layer', 'table'], function () {
        var table = layui.table, form = layui.form, $ = layui.$;
        var geturl = url + user.userMsg;
        var element = layui.element;

        // 获取所有的个人信息
        $.ajax({
            type: "POST",
            url: geturl,
            data: JSON.stringify({ username: localStorage.getItem("userName") }),
            contentType: 'application/json',
            success: function (data) {
                $("#username").val(data.data.username);
                $("#password").val(data.data.password);
                $("#email").val(data.data.email);
                $("#phoneNumber").val(data.data.phoneNumber);
                $("#roleName").val(data.data.roles[0].roleName);
            }
        });
    });
    function updateBtn(){
        layer.open({
            type: 2,
            title: '修改个人信息',
            area: ['60%', '70%'], //宽高
            content: 'updateMsg.html',
            offset: '40px'
        });
    }
</script>


</body>

</html>
